<html>
    <meta charset="utf-8"/>
    <head>
        <title>个人信息修改</title>
        <link href="zhuce.css" rel="stylesheet" type="text/css"/>
    </head>
    <body>
        <div class="zhuce">
        <h1>个人信息修改</h1>
        <form action="regist.php" method="post">
            <table>
                <tr>
                    <td>
                        用户名：
                    </td>
                    <td>
                        <input type="text" name="name"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        真实姓名：
                    </td>                
                    <td>
                        <input type="text" name="sname"/>
                    </td>                
                </tr>
                <tr>
                    <td>
                        密码：
                    </td>                
                    <td>
                        <input type="password" name="pass"/>
                    </td>
                </tr>
                <tr>
                <td>
                    电话：
                </td>
                    <td>
                        <input type="text" name="tel"/>
                    </td> 
                </tr>          
                <tr>
                    <td>
                    班级：
                    </td>
                    <td>
                    <select name="class"><option>class5</option>
                        <option>class6</option>
                        <option>class7</option>
                    </select>
                    </td>
                </tr>
            </table>
            <button style="width:50;margin:5 auto;">提交</button>
        </form>
    </div>

        <?php
            header("Content-Type:text/html;charset=utf-8");
            include('db-conn.php');
            $user=$_POST['name'];
            $pass=$_POST['pass'];
            $tel=$_POST['tel'];
            $sname=$_POST['sname'];
            $class=$_POST['class'];
            //$conn=mysqli_connect('localhost','root','root');
            $zhuce="update  jiuye.user set name=;";
            $cha="select * from jiuye.user where name='$user';";
            $panduan=mysqli_fetch_assoc(mysqli_query($conn,$cha));
            var_dump($panduan[name]);
            if ($panduan[name] == $user){
            echo "<script>alert('用户名已存在');window.location.href='regist.html';</script>";
            }else{
            mysqli_query($conn,$zhuce);
            echo "<script>alert('创建用户成功');window.location.href='index.html';</script>";
            
            }
            mysqli_close($conn);
        ?>
    </body>
</html>